package net.xumf.service.master;


import net.xumf.support.model.dto.QuartzDTO;
import net.xumf.support.model.dto.QuartzJiraDTO;
import net.xumf.support.model.vo.CronTriggerVO;
import org.quartz.JobExecutionContext;
import org.quartz.SchedulerException;

import java.util.List;

public interface QuartzService {


    /**
     * 获取所有任务
     *
     * @return 任务 {@link JobExecutionContext}
     * @throws SchedulerException
     */
    List<CronTriggerVO> getAllJob() throws SchedulerException;

    /**
     * 获取普通所有任务
     *
     * @return 任务 {@link JobExecutionContext}
     * @throws SchedulerException
     */
    List<CronTriggerVO> getAllNormalJob() throws SchedulerException;

    /**
     * QuartzDTO {@link QuartzDTO}
     *
     * @throws SchedulerException
     */
    void addNormalJob(QuartzDTO dto) throws SchedulerException, ClassNotFoundException, IllegalAccessException, InstantiationException;

    /**
     * 暂停定时器
     *
     * @param jobName 定时器名称
     * @throws SchedulerException
     */
    void jobPause(String jobName) throws SchedulerException;

    /**
     * 暂停定时器
     *
     * @param jobName 定时器名称
     * @throws SchedulerException
     */
    void jobPause(String jobName, String group) throws SchedulerException;

    /**
     * 重启定时器
     *
     * @param jobName 定时器名称
     * @throws SchedulerException
     */
    void jobResume(String jobName) throws SchedulerException;

    /**
     * 更新定时器
     * QuartzDTO {@link QuartzDTO}
     * @param jobName 名称
     * @param group 分组
     *
     * @throws SchedulerException
     */
    void jobResume(String jobName, String group) throws SchedulerException;

    /**
     * 更新普通定时器
     * QuartzDTO {@link QuartzJiraDTO}
     *
     * @throws SchedulerException
     */
    void jobNormalReschedule(QuartzDTO dto) throws SchedulerException;

    /**
     * 删除定时器
     *
     * @param jobName 定时器名称
     * @throws SchedulerException
     */
    void jobDelete(String jobName) throws SchedulerException;

    /**
     * 删除定时器
     *
     * @param jobName 定时器名称
     * @param group 组名
     * @throws SchedulerException
     */
    void jobDelete(String jobName, String group) throws SchedulerException;
}
